from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCG_DRG

def group(record):
  adrg_zd=["C20.x00","C78.505","D01.200","D12.600","D12.602","D12.800","D12.900x001","D13.100","D37.400x001","D37.401","D37.500x001","D37.501","K20.x00","K21.001","K26.401","K29.101","K29.400","K29.500","K29.603","K31.703","K31.905","K35.800x001","K52.910","K56.500x003","K56.701","K58.100","K59.000","K60.100","K60.200","K60.300","K61.001","K61.100","K61.101","K61.200","K62.100","K62.100x002","K62.300","K62.301","K62.400x002","K62.600x002","K62.800x010","K62.800x012","K62.808","K62.811","K62.903","K63.500","K63.502","K63.503","K63.504","K63.812","K63.816","K64.805","K64.810","K64.811","K65.900","K92.208","Q43.812","T18.502"]
  adrg_zd1=[]
  adrg_ss=["48.0x01","48.0x02","48.0x04","48.3200x001","48.3200x003","48.3201","48.3501","48.3502","48.3507","48.3514","48.3600x002","48.3600x003","48.3600x004","48.3600x005","48.3601","48.3602","48.3603","48.4102","48.4103","48.4105","48.5000","48.7600x008","48.7601","48.7602","48.7603","48.7605","48.7900x003","48.8101","48.9100","49.5100","70.5200","98.0502"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合GF2入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCG_DRG.GF29_group(record):
      return 'GF29'

    return 'GF2'
  else:
    return ''

